-include $(ROOTDIR)/config.mk

INCDIR += $(ROOTDIR)/include/server/ \
		  $(ROOTDIR)/package/debug/ \
		  $(ROOTDIR)/include/ \
		  $(ROOTDIR)/include/communication/

INCLUDES = $(foreach INCTREE,$(INCDIR),$(addprefix -I, $(INCTREE)))


BIN = server
SOURCE += ./ \
		  ./device \
		  ./app \
		  ./ioctl \
		  .././communication
OBJS = $(notdir $(patsubst %.c, %.o,$(foreach OBJTREE,$(SOURCE),$(wildcard $(OBJTREE)/*.c))))
#LIBS =

vpath %.c $(SOURCE)

.PHONY: all clean 

all: $(OBJS)
	$(CC) -o $(BIN) $(OBJS) $(INCLUDES) $(CFLAGS)

.c.o:
	$(CC) $(CFLAGS)  -c $< $(INCLUDES)

clean:
	rm -rf $(BIN)  *.o